package com.beikai.mybatisplus.config;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.beikai.mybatisplus.methods.MyDelete;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.xml.bind.annotation.XmlType;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: beikai
 * Date: 2019/6/17
 * Time: 16:08
 * Description:   自定义sql 注入
 */
@Component
@Slf4j
public class MySqlInjector extends DefaultSqlInjector {

    /**
     * 重写 getMethodList方法
     * @return
     */
    @Override
    public List<AbstractMethod> getMethodList() {
        log.info("MySqlInjector -> 开始了");
        List<AbstractMethod> abstractMethods = super.getMethodList();
        // 增加自定义的方法
        abstractMethods.add(new MyDelete());
        log.info("MySqlInjector -> 完成了");
        return abstractMethods;
    }
}
